<?php

namespace app\batch;

use think\Db;

use think\console\Command;
use think\console\Input;
use think\console\Output;
use app\models\{Goods, OrderGoods, Compent, SystemGoods, PlatClass};

class Replar extends Command
{
    protected $open = false;
    protected function configure()
    {
        $this->setName('Replar')->setDescription('图片链接转换');
    }

    protected function execute(Input $input, Output $output)
    {
        $this->doCron();
        die();
    }

    protected function doCron()
    {
        $list = (new PlatClass())->select();
        foreach ($list as $lists) {
            $lists['images'] = str_replace("wangapi.dida555.com", "apis.tcwang888.com", $lists['images']);
            // $lists['goodsDesc'] = str_replace("wangapi.dida555.com", "apis.tcwang888.com", $lists['goodsDesc']);

            $lists['images'] = str_replace("wangmanger.dida555.com", "apis.tcwang888.com", $lists['images']);
            // $lists['goodsDesc'] = str_replace("wangmanger.dida555.com", "apis.tcwang888.com", $lists['goodsDesc']);

            $lists['images'] = str_replace("manger2.dida555.com", "apis.tcwang888.com", $lists['images']);
            // $lists['goodsDesc'] = str_replace("manger2.dida555.com", "apis.tcwang888.com", $lists['goodsDesc']);

            (new PlatClass())->where('id', $lists['id'])->update(['images' => $lists['images']]);
        }
    }
}
